import { createRouter, createWebHistory } from 'vue-router'
import search_act from '../views/search_act.vue'
import search_policy from '../views/search_policy.vue'
import search_user from '../views/search_user.vue'
var link=window.location.href;
console.log(link)
var arr=link.split('/');
arr.pop();
console.log(arr)
arr.shift()
arr.shift()
arr.shift()
link=arr.join('/');
console.log(link)
//此路由为search页专用，设置默认路由到政策搜索
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  mode:'hash',
  routes: [
    {
      // 首页
      path: '/'+link+'/policy',
      component: search_policy
    },
    {
      path: '/'+link+'/act',
      component:search_act
    },{
      path: '/'+link+'/user',
      component:search_user
    },{
      path:'/:path(.*)',
      component:search_policy
    }
  ]
})

export default router
